package gps;

public class Square implements Cloneable{
	private Colour colour;
	private boolean visited;
	private int x;
	private int y;
	
	public Square(Colour colour,int x, int y) {
		this.colour = colour;
		this.visited = false;
		this.x = x;
		this.y = y;
	}
	
	public boolean isVisited() {
		return visited;
	}
	
	public void setVisited(boolean visited) {
		this.visited = visited;
	}
	
	public Colour getColour() {
		return colour;
	}
	
	public void setColour(Colour colour) {
		this.colour = colour;
	}
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
		
	@Override
	public String toString() {
		return x + ":" + y + "=" + colour.toString();
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((colour == null) ? 0 : colour.hashCode());
		result = prime * result + x;
		result = prime * result + y;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Square other = (Square) obj;
		if (colour == null) {
			if (other.colour != null)
				return false;
		} else if (!colour.equals(other.colour))
			return false;
		if (x != other.x)
			return false;
		if (y != other.y)
			return false;
		return true;
	}
	
	@Override
	public Square clone() {
		return new Square(this.colour, this.x, this.y);
	}
	
	
}
